package edu.java.homework.hw07.Test0624a;

class A {
    int f() {
	return 0;
    }
}

class B extends A {
    int f() {
	return 1;
    }
}

class C extends B {
    int f() {
	return 2;
    }
}

public class Test0624a {
    public static void main(String[] args) {
	A ref1 = new C();
	B ref2 = (B) ref1;//
	System.out.println(ref2.f());
    }
}

// Result: 2 